package com.zhuss.controller.repair;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.repair.repair.DetailRepairBo;
import com.zhuss.bean.bo.repair.repair.SearchRepairBo;
import com.zhuss.bean.bo.repair.repairKancha.RepairKanchaBo;
import com.zhuss.bean.bo.repair.repairKancha.WeiXiuGoodsBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.ReadService;
import com.zhuss.core.processor.EnumConfig;
import com.zhuss.exception.WpsException;
import com.zhuss.repair.repair.RepairKanchaOperateService;



/**
 * 餐品查询 controller
 * @Author zhushanshuo
   @Date 2020/02/28 16:01
 *
 */
  
 
@RestController
@RequestMapping("/repairKancha")
public class RepairKanchaReadController extends BaseController {
	
	@Autowired
	@Qualifier("repairKanchaReadService")
	private ReadService<Object, Object> repairKanchaReadService;
	
	@Autowired
	@Qualifier("repairKanchaOperateService")
	private RepairKanchaOperateService repairKanchaOperateService;
	
	
	/**
	 * 详情
	 * @param bo
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/detail")
    public Object detail(@RequestBody RepairKanchaBo bo) throws WpsException {
		Object result = repairKanchaReadService.detail(bo);
		return result;
    }
	
	/**
	 * 列表
	 * @param bo
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
    @RequestMapping("/list")
    public Object list(@RequestBody SearchRepairBo bo, HttpServletRequest request) throws WpsException {
		String area = request.getHeader("area");
		bo.setArea(Integer.parseInt(area));
		Object result = repairKanchaReadService.list(bo);
		return result;
    }
	
	
	/**
	 * 获取维修物品数据
	 * @param bo
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/listRepairGoods")
	public Object listRepairGoods(@RequestBody SearchRepairBo bo) throws WpsException {
		Object result =  repairKanchaOperateService.listRepairFoodsCategory(bo);
		return result;
	}
	
	/**
	 * 维修物料更新
	 */
	@ResponseBody
	@PostMapping("/getWeixiuGoodsList")
	public Object getWeiXiuFoods(@RequestBody WeiXiuGoodsBo bo) throws WpsException {
		return repairKanchaOperateService.getWeiXiuFoods(bo);
	}
	
	
	
	
}
